#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 1

int main() {
    int i;
    int j = 0;
    int seed = 1000;
    int numPlayer = 2;
    int maxBonus = 10;
    int p, r, handPos;
    int handCount = 5;
    int bonus;
    int k[10] = {adventurer, council_room, feast, gardens, mine,
                remodel, smithy, village, baron, great_hall};
    struct gameState G;
    int maxHandCount = 50;
    //remodel is enum 12
    int remodel[MAX_HAND];

    printf ("TESTING Remodel():\n");
        for (int ch1 = 0; ch1 <= 10; ++ch1)
        {
#if (NOISY_TEST == 1)
                printf("Remodel: Test player 0 with %d cards before discard\n", handCount);
#endif
                memset(&G, 23, sizeof(struct gameState));   // clear the game state
                r = initializeGame(numPlayer, k, seed, &G); // initialize a new game
                G.handCount[p] = handCount;                 // set the number of cards on hand
                memcpy(G.hand[p], remodel, sizeof(int) * handCount); // set all the cards to smithy
                int returned = remodelCard(0, ch1, &G, 0); 
                
#if (NOISY_TEST == 1)
                printf("Remodel: G.handCount = %d, returned= %d\n", numHandCards(&G), returned);
#endif
                //assert(numHandCards(&G) == handCount + 2); // check if the number of cards is correct
#if (NOISY_TEST == 1)
                printf("Effect: Test player 0 with %d cards before discard\n", handCount);
#endif
                memset(&G, 23, sizeof(struct gameState));   // clear the game state
                r = initializeGame(numPlayer, k, seed, &G); // initialize a new game
                G.handCount[p] = handCount;                 // set the number of cards on hand
                memcpy(G.hand[p], remodel, sizeof(int) * handCount); // set all the cards to smithy
                returned = cardEffect(12, 0, ch1, 0, &G, 0, 0);

#if (NOISY_TEST == 1)
                printf("Effect: G.handCount = %d, returned= %d\n", numHandCards(&G), returned);
#endif
                //assert(numHandCards(&G) == handCount + 2); // check if the number of cards is correct
    }

    printf("All tests passed!\n");

    return 0;
}
